//
//  DDNetWorkManager.h
//  DingDongZP
//
//  Created by Jyh on 16/3/17.
//  Copyright © 2016年 iyhjiang.com. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface DDNetWorkManager : NSObject

@property (copy, nonatomic) void(^failureError)(void);
@property (copy, nonatomic) void(^success)(NSString *);

+ (instancetype)shareManager;

/**
 *  get请求
 *
 *  @param URLString  请求URL地址
 *  @param parameters 参数字典
 *  @param success    成功block回调
 *  @param failure    失败block回调
 */
- (void)GET:(NSString *)URLString
 parameters:(id)parameters
    success:(void (^)(id responseObject))success
    failure:(void (^)(id responseObject, NSError *error))failure;


/**
 *  post请求
 *
 *  @param URLString  请求URL地址
 *  @param parameters 参数字典
 *  @param success    成功block回调
 *  @param failure    失败block回调
 */
- (void)POST:(NSString *)URLString
  parameters:(id)parameters
     success:(void (^)(id responseObject))success
     failure:(void (^)(id responseObject, NSError *error))failure;


/**
 *  不带token的Post请求 (登录注册，修改密码等)
 *
 *  @param URLString  请求URL地址
 *  @param parameters 参数字典
 *  @param success
 *  @param failure
 */
- (void)POSTWithNoToken:(NSString *)URLString
             parameters:(id)parameters
                success:(void (^)(id responseObject))success
                failure:(void (^)(id responseObject, NSError *error))failure;

- (void)UPLOAD:(NSString *)URLString parameters:(id)parameters filesDatas:(NSDictionary *)files
       success:(void (^)(id responseObject))success
       failure:(void (^)(id responseObject, NSError *error))failure;
/** 语音微简历上传 单个文件 */
- (void)UPLOAD_VOICE:(NSString *)URLString parameters:(id)parameters filesDatas:NSData
             success:(void (^)(id))success
             failure:(void (^)(id, NSError *))failure;

#pragma mark - swizzle hook 专用 [注：添加新的请求方法(直接调用AFHTTPRequestOperationManager的请求方法)，响应方法中必须使用以下两个作为响应方法]

- (void)execCompletionBlockWithSuccess:(void (^)( id responseObject))success url:(NSURL *)url responseObject:(id)responseObject;

- (void)execCompletionBlockWithFailure:(void (^)( id responseObject,NSError * error))failure url:(NSURL *)url responseObject:(id)responseObject err:(NSError *)error;

@end
